<!--
 * @Author: your name
 * @Date: 2025-07-01 14:39:25
 * @LastEditors: your name
 * @LastEditTime: 2025-07-21 10:22:01
 * @Description: 
 * @FilePath: \wot-vue3\pages\index\index.vue
-->
<template>
	<wd-button>主要按钮</wd-button>
	<wd-button type="success" @click="showToast">成功按钮</wd-button>
	<wd-button type="info">信息按钮</wd-button>
	<wd-toast />
	<wd-signature @confirm="confirm" @clear="clear" :export-scale="2" background-color="#ffffff" />
	<view @click="closeOutside">
	  <wd-drop-menu>
	    <wd-drop-menu-item v-model="value1" :options="option1" @change="handleChange1" />
	    <wd-drop-menu-item v-model="value2" :options="option2" @change="handleChange2" />
	  </wd-drop-menu>
	</view>
	<wd-img :width="100" :height="100" src="https://dummyimage.com/400x200/3c9cff/fff" />
</template>

<script setup >
    import { useToast } from '@/uni_modules/wot-design-uni'
	import { useQueue } from '@/uni_modules/wot-design-uni'
	import { useUserStore } from '@/store/user';
	const userStore = useUserStore();
	const toast = useToast()
	const img = ref({})
	const { closeOutside } = useQueue()
	const value1 = ref(0)
	const value2 = ref(0)
	const option1 = ref([
	  { label: '全部商品', value: 0 },
	  { label: '新款商品', value: 1 },
	  { label: '活动商品', value: 2 }
	])
	const option2 = ref([
	  { label: '综合', value: 0 },
	  { label: '销量', value: 1 },
	  { label: '上架时间', value: 2 }
	])
	function handleChange1({ value }) {
	  console.log(value)
	}
	function handleChange2({ value }) {
	  console.log(value)
	}
	function showToast() {
		// 方式二：批量覆盖（推荐）
		// userStore.$patch({
		//   token: '22',
		// });
		uni.switchTab({
			url: '/pages/mine/mine'
		})
	}
	function confirm(result) {
	  if (result.success) {
	    uni.previewImage({
	      urls: [result.tempFilePath]
	    })
	  }
	}
	
	function clear() {
	  img.value = {}
	}
	
	const getGoods = async () => {
	    const res = await GetEnterprisePageList({"pageNo":1,"pageSize":10,"entName":null,"state":null});
	    console.log('res', res);
	};
</script>
<style lang="scss">
	.content{
		height: 200px;
		background-color: #f20;
	}
</style>